﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="wfAddVehicle.aspx.cs" Inherits="msBsc.WebUi.ShpMana.wfAddVehicle" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
 <title>添加地接客车辆</title>
    <link href="/themes/wStyle1/css/sLayout.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/sHead.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/sFoot.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/usermenu.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/from.css" rel="stylesheet" />
    <link href="/jqPlugin/hdfu/hdfu.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/Seller/sReleaseForum.css" rel="stylesheet" />
    <link href="/jqPlugin/kindeditor/themes/default/default.css" type="text/css" rel="stylesheet" />
    <link href="/jqPlugin/layer/skin/layer.css" rel="stylesheet" />
    <link href="/jqPlugin/laydate/skins/default/laydate.css" rel="stylesheet" />
    <style type="text/css">
        .texarea {
            width: 648px;
            height: 150px;
        }

        #logo_img_selected img {
            max-height: 300px;
            /*max-width:150px;*/
        }

        .selCondition li {
            background-color: #f5f5f5;
            border: 1px solid #f5f5f5;
            float: left;
            line-height: 20px;
            margin-right: 5px;
            margin-top: 3px;
            padding: 4px 10px;
        }

        .divMaxCondition {
            display: inline;
            float: left;
            text-align: left;
            width: 720px;
        }

        .cancel {
            cursor: pointer;
            padding-left: 5px;
        }

        .additem {
            margin-left: 10px;
            cursor: pointer;
        }
    </style>
</head>
<body>
    <div class="wf_all">
        <div class="main-container">
            <div class="main-Info" style="margin-bottom: 200px;">
                <div class="main-horizontal">
                    <div class="r_row">
                        <span class="control-span">地接客<span class="required">*</span></span><div class="controls">
                            <input type="text" id="djackId" readonly="readonly" class="input titleInput" />
                        </div>
                    </div>
                    <div class="r_row">
                        <span class="control-span">车辆名称<span class="required">*</span></span><div class="controls">
                            <input type="text" id="vehicleName" class="input titleInput" />
                        </div>
                    </div>
                    <div class="r_row">
                        <span class="control-span">车牌号<span class="required">*</span></span>
                        <div class="controls">
                            <input type="text" id="vehicleNumber" class="input titleInput" />
                        </div>
                    </div>
                    <div class="r_row">
                        <span class="control-span">购买时间<span class="required">*</span></span>
                        <div class="controls">
                            <input type="text" id="buyTime" class="laydate-icon input titleInput" />
                        </div>
                    </div>
                    <div class="r_row">
                        <span class="control-span">座位数<span class="required">*</span></span>
                        <div class="controls">
                            <input type="text" id="vehicleSeats" class="input titleInput" />
                            <%--<span id="forumInfoMessage" class="help-inline">配合标题显示在首图上，一般为一个特色景点+路线行程天数</span>--%>
                        </div>
                    </div>
                    <div class="r_row">
                        <span class="control-span">价格<span class="required">*</span></span>
                        <div class="controls">
                            <input type="text" id="price" class="input titleInput" />
                        </div>
                    </div>
                    <div class="r_row">
                        <span class="control-span">服务范围<span class="required">*</span></span>
                        <div class="controls">
                            <input type="text" id="serviceArea" class="input titleInput" />
                        </div>
                    </div>
                    <div class="r_row">
                        <span class="control-span">车辆品牌<span class="required">*</span></span>
                        <div class="controls">
                            <select id="vehicleBrand" class="input titleInput"></select>
                        </div>
                    </div>
                    <div class="r_row">
                        <span class="control-span">车辆类型<span class="required">*</span></span>
                        <div class="controls">
                            <select id="vehicleType" class="input titleInput"></select>
                        </div>
                    </div>
                    <div class="r_row">
                        <span class="control-span">车辆颜色<span class="required">*</span></span>
                        <div class="controls">
                            <select id="vehicleColor" class="input titleInput"></select>
                        </div>
                    </div>
                    <div class="r_row">
                        <span class="control-span">服务类型<span class="required">*</span></span>
                        <div class="controls">
                            <select id="serviceType" class="input titleInput">
                                <option value="1">司机兼导游</option>
                                <option value="2">司机兼向导</option>
                                <option value="3">专职司机+专业导游</option>
                            </select>
                        </div>
                    </div>
                    <div class="r_row">
                        <span class="control-span">人车图片<span class="required">*</span></span>
                        <div class="controls">
                            <table border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td>
                                        <div id="logo_img_selected">
                                            <img id="uHeadImg" src="/themes/Style1/Image/u_head_110x110.png" for="" />
                                        </div>
                                    </td>
                                    <td style="padding: 3px;">
                                        <div style="padding: 5px;">
                                            <a id="btnupImg" target="_self" value="上传图片" style="margin: 6px; cursor: pointer;" onclick="javascript:return false;">上传图片</a>
                                            <p>
                                                文件大小不能大于1M
                                            </p>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                    <div style="text-align: center; margin-top: 20px;">
                        <input type="button" onclick="AddVehicle();" class="releaseBtn" style="margin-right: 20px;" value="发布" />
                    </div>
                </div>
            </div>
        </div>
        <!--start JS引用-->
        <script src="/jqPlugin/js/jquery-1.8.3.min.js"></script>
        <script src="/jqPlugin/js/jBase.js"></script>
        <script src="/jqPlugin/js/jBPage.js"></script>
        <script src="/jqPlugin/js/laytpl.js"></script>
        <script src="/jqPlugin/layer/layer.min.js"></script>
        <script src="/jqPlugin/laydate/laydate.js" type='text/javascript'></script>

        <script src="/themes/wStyle1/js/comm/VerifyJs.js"></script>
        <script src="/jqPlugin/SelectSimu/js/SelectSimu.js"></script>
        <script src="/themes/wStyle1/js/comm/jsLayout.js"></script>

        <!--end JS引用-->
        <script type="text/javascript">
            var start = {
                elem: '#buyTime',
                format: 'YYYY-MM-DD',
                min: '1099-06-16 23:59:59', //设定最小日期为当前日期
                max: laydate.now(), //最大日期
                istime: true,
                istoday: false,
                choose: function (datas) {
                    //end.min = datas; //开始日选好后，重置结束日的最小日期
                    //end.start = datas //将结束日的初始值设定为开始日
                    //computingPrice();
                }
            };
            laydate(start);

            function SetEditHtml(_sHtml) {
                scontenthtml = _sHtml;
            };
            var scontenthtml = '';
            $(function () {
                $.ploadFile("kindeditor", function (script, textStatus) {
                    $.setUploadFile('btnupImg', { FileId: '', RelId: "", rType1: '0', rType2: '' }, function (data) {
                        if (data.url) {
                            $('#logo_img_selected').empty().html('<img alt="" src="' + data.url + '" for="' + data.url + '">');
                        }
                    });
                });
            });

            (function () {
                var djackId = GetQueryStr("djackId");
                var djackName = GetQueryStr("djackName");
                $("#djackId").val(djackName);
                $("#djackId").attr("data-value", djackId);
                btnDo("init");

            })();

            function btnDo(sEbtn) {
                GtGrid1Action = sEbtn;
                var opart = new jsonRow();
                if (sEbtn=="published") {

                }
                opart.AddCell("ACTION", GtGrid1Action);
                ajaxComm(opart);
            }


            function setSelect(inpuId, data)
            {
                if (IsNull(data)) {
                    return;
                }
                var select = $("#" + inpuId);
                select.html("");
                for (var i = 0; i < data.rows.length; i++) {
                    select.append("<option value='" + data.rows[i]["enum_Value"] + "'>" + data.rows[i]["enum_Name"] + "</option>")
                }

            }

            //执行AJAX调用时获取参数
            function AddVehicle() {


                //地接客
                var djackId = $.trim($("#djackId").attr("data-value"));
                if (IsNull(djackId)) {
                    layer.alert('请选择地接客', 3);
                    return;
                }

                //车辆名称
                var vehicleName = $.trim($("#vehicleName").val());
                if (IsNull(vehicleName)) {
                    layer.alert('请填写车辆名称', 3);
                    return;
                }

                if (vehicleName.length > 20) {
                    layer.alert("车辆名称不能超过20个字符",3);
                    return;
                }
                //车牌号
                var vehicleNumber = $.trim($("#vehicleNumber").val());
                if (IsNull(vehicleNumber)) {
                    layer.alert('车牌号不能为空', 3);
                    return;
                }
                if (vehicleNumber.length > 10) {
                    layer.alert("车牌号不能超过10个字符", 3);
                    return;
                }
                if (vehicleNumber.length < 5) {
                    layer.alert("车牌号不能少于5个字符", 3);
                    return;
                }
                //购买时间
                var buyTime = $.trim($("#buyTime").val());
                if (IsNull(buyTime)) {
                    layer.alert('购买时间不能为空', 3);
                    return;
                }
                //座位数
                var vehicleSeats = $.trim($("#vehicleSeats").val());
                if (IsNull(vehicleSeats)) {
                    layer.alert('座位数不能为空', 3);
                    return;
                }
                if (!NonzeroPositiveInt(vehicleSeats)) {
                    layer.alert("车辆座位数只能是正整数",3);
                    return;
                }
                //价格
                var price = $.trim($("#price").val());
                if (IsNull(price)) {
                    layer.alert('价格不能为空', 3);
                    return;
                }
                if (!IsPositiveFloat(price)) {
                    layer.alert("价格只能是数字", 3);
                    return;
                }
                //服务范围
                var serviceArea = $.trim($("#serviceArea").val());
                if (IsNull(serviceArea)) {
                    layer.alert('服务范围不能为空', 3);
                    return;
                }
                if (vehicleNumber.length > 100) {
                    layer.alert("服务范围不能超过100个字符", 3);
                    return;
                }
                //车辆品牌
                var vehicleBrand = $("#vehicleBrand").val();
                //车辆类型
                var vehicleType = $("#vehicleType").val();
                //车辆颜色
                var vehicleColor = $("#vehicleColor").val();
                //服务类型
                var serviceType = $("#serviceType").val();
             

                //人车图片
                var picture = $("#logo_img_selected").children().eq(0).attr("for");
                if (IsNull(picture)) {
                    layer.alert('请选择人车图片', 2);
                    return;
                }
                layer.load('正在保存中…', 2);
                var _jsParam = new jsonRow();

                _jsParam.AddCell("djkId", djackId);
                _jsParam.AddCell("vehicleName", vehicleName);
                _jsParam.AddCell("buyTime", buyTime);

                _jsParam.AddCell("seats", vehicleSeats);
                _jsParam.AddCell("price", price);
                _jsParam.AddCell("serviceArea", serviceArea);

                _jsParam.AddCell("vehicleType", vehicleType);
                _jsParam.AddCell("vehicleBrand", vehicleBrand);
                _jsParam.AddCell("vehicleColor", vehicleColor);

                _jsParam.AddCell("serviceType", serviceType);

                _jsParam.AddCell("picture", picture);
                _jsParam.AddCell("vehicleNumber", vehicleNumber);
                _jsParam.AddCell("ACTION", "addVehicle");

                ajaxComm(_jsParam);
            };
            function success() {
                layer.alert('添加成功', 1);
                setTimeout(function () {
                    location.reload();
                }, 2000);
            }
        </script>
    </div>
</body>
</html>
